package com.lhkj.ct.meta.modules.gauge.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.lhkj.ct.base.enums.DeleteStatus;
import com.lhkj.ct.meta.modules.gauge.common.enums.ScoreType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 量表维度
 * </p>
 *
 * @author jobob
 * @since 2023-10-16
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="TblScaleDimension对象", description="量表维度")
public class TblScaleDimension implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId
    @ApiModelProperty(value = "维度id")
    private String id;

    @ApiModelProperty(value = "量表id")
    @NotBlank(message = "量表id不能为空")
    private String scaleId;

    @ApiModelProperty(value = "维度名称")
    @Pattern(regexp = "^[a-zA-Z\u4e00-\u9fa5【】—]+$", message = "维度名称只能包含中文、英文或“—【】”符号")
    @NotBlank(message = "维度名称不能为空")
    private String dimName;

    @ApiModelProperty(value = "维度类型 1.普通 2.总评")
    @NotNull(message = "请设置维度类型")
    @Range(min = 1, max = 2, message = "维度类型不合法")
    private Integer dimType;

    @ApiModelProperty(value = "性别")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String suitSex;

    @ApiModelProperty(value = "最小年龄")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Integer minAge;

    @ApiModelProperty(value = "最大年龄")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Integer maxAge;

    @ApiModelProperty(value = "计分方式")
    @NotNull(message = "请选择维度计分方式")
    private ScoreType way;

    @ApiModelProperty(value = "是否开启预警")
    @NotNull(message = "请设置是否开启预警")
    private Boolean warn;

    @ApiModelProperty(value = "公式")
    private String formula;

    @ApiModelProperty(value = "排序")
    @NotNull(message = "请设置维度排序")
    private Integer sort;

    @TableField(fill = FieldFill.INSERT)
    @TableLogic
    @ApiModelProperty(value = "删除状态 0.未删除 1.已删除")
    private DeleteStatus delFlag;

    @TableField(exist = false)
    @ApiModelProperty(value = "题目关联")
    private List<TblScaleDimQuestion> relations;

    @TableField(exist = false)
    @ApiModelProperty(value = "解释说明")
    private List<TblScaleDimNorm> norms;

    @TableField(exist = false)
    @ApiModelProperty(value = "预警设置")
    private List<TblScaleWarnSetting> warnSettings;

}
